#ifndef __CHAIN_H__
#define __CHAIN_H__
#include <iostream>
#include <string>

class Request{
public:
    Request(const std::string& name,int leavedays):m_name(name),m_days(leavedays){}
    void showRequest() const{
        std::cout << m_name << " 请假 " << m_days <<" 天。"<< std::endl;
    }
    int getLeaveDays() const {
        return m_days;
    }
private:
    std::string m_name;
    int m_days;
};

class Handler{
public:
    virtual void handle(const Request& request) = 0;
    virtual void setNext(Handler* next) = 0;
};

class ClassTeacher : public Handler{
private:
    Handler* m_next_handler;

public:
    virtual void handle(const Request& request) override;
    virtual void setNext(Handler* next){
        m_next_handler = next;
    }
};

class DepartmentLeader : public Handler{
private:
    Handler* m_next_handler;

public:
    virtual void handle(const Request& request) override;
    virtual void setNext(Handler* next){
        m_next_handler = next;
    }
};

class VicePrincipal: public Handler{
private:
    Handler* m_next_handler;

public:
    virtual void handle(const Request& request) override;
    virtual void setNext(Handler* next){
        m_next_handler = next;
    }
};

class Principal: public Handler{
private:
    Handler* m_next_handler;

public:
    virtual void handle(const Request& request) override;
    virtual void setNext(Handler* next){
        m_next_handler = next;
    }
};


#endif